package com.hc.model.code02.test8;

/**
 * @version v1.0
 * @ClassName: CoffeeStore
 * @Description: 咖啡商店类
 * @Author: HC
 */
public class CoffeeStore {

    public Coffee orderCoffee(String type) {
        Coffee coffee = null;
        if ("american".equals(type)) {
            coffee = new AmericanCoffee();
        } else if ("latte".equals(type)){
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("没有该类型的咖啡！！");
        }
        // 加配料
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}
